package com.shen.nettysocketchat.bean

import com.shen.nettysocketchat.bean.ContentMessage
import com.shen.nettysocketchat.bean.SingleMessage
import com.shen.nettysocketchat.utils.StringUtil
import java.lang.Exception

/**
 * 单聊消息
 */
class SingleMessage : ContentMessage(), Cloneable {

    override fun hashCode(): Int {
        try {
            return msgId.hashCode()
        } catch (ex: Exception) {
            ex.printStackTrace()
        }
        return 1
    }

    override fun equals(obj: Any?): Boolean {
        if (obj == null) {
            return false
        }
        return if (obj !is SingleMessage) {
            false
        } else StringUtil.equals(msgId, obj.msgId)
    }
}